<style lang="less">
.clearfloat {
  &::after {
    content: "";
    display: block;
    clear: both;
  }
}

.wrap {
  padding-bottom: 80px;
}

.head {
  position: relative;
  height: 200px;
  .bgcolor {
    position: absolute;
    background: #f3c5a3;
    height: 70px;
    left: 0;
    top: 0;
    width: 100%;
  }
  .banner {
    position: relative;
    top: 20px;
    margin: 0 15px;
    height: 180px;
    background-color: #f5f;
    border-radius: 6px;
  }
}

.tabs {
  ul {
    padding: 10px 0;
    li {
      position: relative;
      display: inline-block;
      color: #666666;
      font-size: 15px;
      margin: 0 15px;
    }
    .active {
      color: #e44f61 !important;
      &::after {
        content: "";
        display: block;
        position: absolute;
        width: 90%;
        height: 3px;
        background-color: #e44f61;
        border-radius: 2px;
        bottom: -5px;
        left: 5%;
      }
    }
  }
}

.foodlist {
  background-color: #f3f3f3;
  padding-top: 10px;

  .contner {
    width: 98%;
    margin: 0 auto;
  }

  .item {
    float: left;
    width: 46%;
    margin: 0 2%;
    margin-bottom: 5px;
    box-sizing: border-box;
    position: relative;
    border-radius: 6px;
    background-color: #fff;

    .foodimg {
      position: relative;
      height: 160px;
      overflow: hidden;
      img {
        display: block;
        width: 100%;
      }
    }
    .foodlast {
      position: absolute;
      top: 10px;
      right: 10px;
      padding: 4px 8px;
      background: #fff1f1;
      border-radius: 18px;
      color: #666666;
      font-size: 12px;
      z-index: 20;
    }
    .foodname {
      padding: 0 5px;
      font-size: 14px;
      color: #303030;
    }
    .foodprise {
      position: relative;
      height: 30px;
      margin-top: 10px;
      margin-bottom: 10px;
      padding-left: 5px;
      .style1 {
        height: 30px;
        border-radius: 15px;
        box-sizing: border-box;
        img {
          margin-right: 10px;
          width: 20px;
          height: 20px;
        }
        .num1 {
          display: inline-block;
          color: #d73018;
          font-size: 12px;
        }
        .num2 {
          display: inline-block;
          font-size: 12px;
          color: #666666;
          margin-right: 5px;
        }
        .num3 {
          position: relative;
          top: 6px;
          right: 5px;
          float: right;
          font-size: 12px;
          color: #999999;
        }
      }
      .style2 {
        box-sizing: border-box;
        height: 30px;
        position: absolute;
        border-radius: 15px;
        background: #644e4e;
        img {
          margin-right: 10px;
          width: 20px;
          height: 20px;
        }
        .num1 {
          color: #fff;
          font-size: 12px;
        }
        .text {
          display: inline-block;
          border-radius: 15px;
          line-height: 30px;
          height: 30px;
          background: #f9b721;
          color: #ffffff;
          font-size: 12px;
          padding: 0 15px;
          margin-left: 15px;
        }
      }
    }
  }
}
</style>
<template>
  <div class="wrap">
    <div class="head">
      <div class="bgcolor"></div>
      <div class="banner"></div>
    </div>

    <div class="tabs">
      <ul>
        <li class="active">全部</li>
        <li class>内容护肤</li>
        <li class>数码3C</li>
      </ul>
    </div>

    <div class="foodlist">
      <div class="contner clearfloat">
        <div class="item" v-for="(item, index) in list" :key="index" @click="clickitem(index)">
          <div class="foodimg">
            <img :src="item.img">
          </div>
          <div class="foodlast">仅剩:{{item.last}}件</div>
          <div class="foodname">{{item.name}}</div>
          <div class="foodprise">
            <div class="style1" v-show="item.type == 1">
              <img class="jinbi" src>
              <span class="num1">{{item.jinbi}}</span>
              <span class="num2">+￥{{item.prise}}</span>
              <span class="num3">
                原价:
                <span class="midline">￥{{item.source}}</span>
              </span>
            </div>
            <div class="style2" v-show="item.type == 2">
              <img class="jinbi" src>
              <span class="num1">300</span>
              <span class="text">免费兑换</span>
            </div>
          </div>
        </div>
      </div>
    </div>

    <footbar/>
  </div>
</template>

<script>
import footbar from "../components/footbar.vue";
export default {
  data() {
    return {
      targetPagePath: "", // 跳转的目标页
      param: null, // 附带参数
      authNickname: true, // 默认有 昵称授权
      jumped: false,

      list: [
        {
          type: 1,
          img: "",
          last: 12,
          name: "商品差距套装",
          jinbi: 300,
          prise: 60,
          source: 359
        },
        {
          type: 2,
          img: "",
          last: 12,
          name: "商品差距套装",
          jinbi: 300,
          prise: 60,
          source: 359
        },
        {
          type: 2,
          img: "",
          last: 12,
          name: "商品差距套装",
          jinbi: 300,
          prise: 60,
          source: 359
        },
        {
          type: 1,
          img: "",
          last: 12,
          name: "商品差距套装",
          jinbi: 300,
          prise: 60,
          source: 359
        }
      ]
    };
  },
  components:{
    footbar
  },
  methods: {
    toTargetPage() {
      this.$router.reLaunch("food_stamps/" + this.targetPagePath, this.param);
    },
    clickitem(index) {
      var aa = this.list[index];
      console.log(aa);
    }
  }
};
</script>


